package com.bw.employee.controller;

import com.bw.employee.service.TbSectionService;
import com.bw.result.ResultVo;
import com.bw.vo.IdVo;
import com.bw.vo.TbSectionSearchVo;
import com.bw.vo.TbSectionVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liuzhihao
 * @version 1.0
 * @description: TODO
 * @date 2023/11/10 21:47:26
 */
@RestController
@Slf4j
@RequestMapping("/section")
public class TbSectionController {

    @Autowired
    private TbSectionService tbSectionService;

    /**
     * @description : //TODO 添加部门
     * @param tbSectionVo
     * @return : com.bw.result.ResultVo
     * @author : liuzhihao
     * @date : 2023/11/10 21:58:30
     */
    @PostMapping("/add")
    public ResultVo add(@RequestBody TbSectionVo tbSectionVo){
        return tbSectionService.add(tbSectionVo);
    }

    /**
     * @description : //TODO 编辑部门
     * @param tbSectionVo
     * @return : com.bw.result.ResultVo
     * @author : liuzhihao
     * @date : 2023/11/11 9:43:48
     */
    @PostMapping("/update")
    public ResultVo update(@RequestBody TbSectionVo tbSectionVo){
        return tbSectionService.updateByVo(tbSectionVo);
    }

    /**
     * @description : //TODO 删除部门
     * @param idVo
     * @return : com.bw.result.ResultVo
     * @author : liuzhihao
     * @date : 2023/11/11 14:51:52
     */
    @PostMapping("/delete")
    public ResultVo delete(@RequestBody IdVo idVo){
        return tbSectionService.delete(idVo);
    }

    /**
     * @description : //TODO 权限设置
     * @param tbSectionVo
     * @return : com.bw.result.ResultVo
     * @author : liuzhihao
     * @date : 2023/11/11 17:18:49
     */
    @PostMapping("/permissionSet")
    public ResultVo permissionSet(@RequestBody TbSectionVo tbSectionVo){
        return tbSectionService.permissionSet(tbSectionVo);
    }

    /**
     * @description : //TODO 部门精准搜索 + 分页查询
     * @param tbSectionSearchVo
     * @return : com.bw.result.ResultVo
     * @author : liuzhihao
     * @date : 2023/11/12 18:44:26
     */
    @PostMapping("/listBySearchVo")
    public ResultVo listBySearchVo(@RequestBody TbSectionSearchVo tbSectionSearchVo){
        return tbSectionService.listBySearchVo(tbSectionSearchVo);
    }

    /**
     * @description : //TODO 部门下拉框数据
     * @return : com.bw.result.ResultVo
     * @author : liuzhihao
     * @date : 2023/11/16 9:10:48
     */
    @PostMapping("/sectionList")
    public ResultVo sectionList(){
        return tbSectionService.sectionList();
    }
}
